var _echarts = require("../charts/echarts"), echarts = _interopRequireWildcard(_echarts);

function _interopRequireWildcard(t) {
    if (t && t.__esModule) return t;
    var a = {};
    if (null != t) for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (a[o] = t[o]);
    return a.default = t, a;
}

var app = getApp(), animationShowHeight = 300;

Page({
    data: {
        navH: 0,
        pageScroll: !1,
        animationData: "",
        showShareStatus: !1,
        source: 1,
        goods_id: 0,
        goods: !1,
        showShareBg: !1,
        poster: "",
        share_pic: !1,
        from_uid: !1,
        per: 0,
        listHeight: 0,
        isStartRewards: !1,
        opt_id: 0,
        rec_page: 1,
        rec_loading: !1,
        recGoodsList: !1,
        hot_page: 1,
        hot_loading: !1,
        hotGoodsList: !1,
        goods_url: "",
        goods_sign: "",
        left_deg: 45,
        right_deg: 45,
        appletKeyword: "",
        freered_id: 0,
        shop_red_sum: 0,
        imgPath: app.getImgUrl(),
        mobile_short_url: !1,
        beginAnimation: !1,
        tbCopy: !1,
        copyTbBtnText: "一键复制",
        onVideo: !1,
        videoPath: !1,
        showMainV: !1,
        showHisP: !1,
        ecLine: {
            lazyLoad: !0
        }
    },
    getJdStore: function() {
        var a = this;
        app.globalData.userInfo ? void 0 === a.data.goods.storeInfo.page_path ? app.util.request({
            url: "entry/wxapp/getJdStore",
            data: {
                shop_id: a.data.goods.storeInfo.sellerId
            },
            success: function(t) {
                console.log(t), a.data.goods.storeInfo.appid = t.data.data.appid, a.data.goods.storeInfo.page_path = t.data.data.page_path, 
                wx.navigateToMiniProgram({
                    appId: t.data.data.appid,
                    path: t.data.data.page_path,
                    success: function(t) {
                        console.log("ok");
                    }
                });
            }
        }) : wx.navigateToMiniProgram({
            appId: a.data.goods.storeInfo.appid,
            path: a.data.goods.storeInfo.page_path,
            success: function(t) {
                console.log("ok");
            }
        }) : app.checkLogin();
    },
    getTbStore: function() {
        var a = this;
        app.globalData.userInfo ? void 0 === a.data.goods.storeInfo.tpwd ? app.util.request({
            url: "entry/wxapp/getTbStore",
            data: {
                sellerId: a.data.goods.storeInfo.sellerId,
                shopName: a.data.goods.storeInfo.mall_name
            },
            success: function(t) {
                a.data.goods.storeInfo.tpwd = t.data.data, wx.setClipboardData({
                    data: a.data.goods.storeInfo.tpwd,
                    success: function(t) {
                        app.globalData.showSmart = !1, wx.showModal({
                            title: "系统信息",
                            content: "店铺淘口令复制成功，打开淘宝即可浏览店铺：）",
                            showCancel: !1,
                            confirmColor: "#f43f6c",
                            confirmText: "朕知道了"
                        }), wx.hideToast();
                    }
                });
            }
        }) : wx.setClipboardData({
            data: a.data.goods.storeInfo.tpwd,
            success: function(t) {
                app.globalData.showSmart = !1, wx.showModal({
                    title: "系统信息",
                    content: "店铺淘口令复制成功，打开淘宝即可浏览店铺：）",
                    showCancel: !1,
                    confirmColor: "#f43f6c",
                    confirmText: "朕知道了"
                }), wx.hideToast();
            }
        }) : app.checkLogin();
    },
    toHomepage: function(t) {
        t = t.currentTarget.dataset.mall_id, wx.navigateTo({
            url: "../homepage/homepage?mall_id=" + t
        });
    },
    showMainVideo: function() {
        this.setData({
            showMainV: !this.data.showMainV
        });
    },
    toEvapage: function() {
        wx.navigateTo({
            url: "./eva-page?goods_id=" + this.data.goods_id
        });
    },
    copyShare: function() {
        var a = this;
        app.globalData.userInfo ? wx.setClipboardData ? wx.setClipboardData({
            data: 6 == a.data.source ? a.data.goods.mobile_short_url : a.data.goods.goods_name + "\n👉︎入口" + a.data.mobile_short_url,
            success: function(t) {
                app.globalData.showSmart = !1, 6 == a.data.source && (app.globalData.userInfo.tao_ord || a.data.goods.tao_bind || wx.showModal({
                    title: "系统信息",
                    content: "“首次”复制口令购买后您须手动复制淘宝订单号，添加至小程序订单页面实现返佣，后续即可自动返佣：）",
                    showCancel: !1,
                    confirmColor: "#f43f6c",
                    confirmText: "朕知道了",
                    complete: function() {}
                })), wx.showToast({
                    title: "复制成功"
                });
            }
        }) : console.log("当前微信版本不支持setClipboardData") : app.checkLogin();
    },
    toShoppingRed: function(t) {
        void 0 !== t.detail.formId && (console.log(t.detail.formId), app.formIds.push(t.detail.formId)), 
        wx.navigateTo({
            url: "../shopping-red-envelopes/shopping-red-envelopes"
        });
    },
    toCatePage: function(t) {
        var a = t.currentTarget.dataset.opt_id, t = t.currentTarget.dataset.opt_name;
        wx.navigateTo({
            url: "../allclassify/cate?opt_id=" + a + "&opt_name=" + t
        });
    },
    toHotMore: function() {
        wx.navigateTo({
            url: "../region/region"
        });
    },
    toOtherGoods: function(t) {
        var a = t.currentTarget.dataset.goods_id;
        void 0 !== t.currentTarget.dataset.goods_sign && (a += "&goods_sign=" + t.currentTarget.dataset.goods_sign), 
        wx.navigateTo({
            url: "./goods?goods_id=" + a
        });
    },
    getHotGoods: function() {
        var a = this;
        a.data.hot_loading || (a.data.hot_loading = !0, app.util.request({
            url: "entry/wxapp/getHotGoods",
            showLoading: !1,
            data: {
                page: a.data.hot_page,
                sort_type: 1
            },
            success: function(t) {
                console.log(t), t.data.data.length < 1 || (a.data.hotGoodsList = 1 == a.data.hot_page ? t.data.data : a.data.hotGoodsList.concat(t.data.data), 
                a.setData({
                    hotGoodsList: a.data.hotGoodsList
                }), a.data.hot_page++);
            },
            complete: function() {
                a.data.hot_loading = !1;
            }
        }));
    },
    getRecGoods: function() {
        var a = this;
        a.data.rec_loading || (a.data.rec_loading = !0, app.util.request({
            url: "entry/wxapp/getRcommendGoods",
            showLoading: !1,
            data: {
                page: a.data.rec_page,
                channel_type: 7
            },
            success: function(t) {
                console.log("1"), console.log(t), t.data.data.length < 1 || (a.data.recGoodsList = 1 == a.data.rec_page ? t.data.data : a.data.recGoodsList.concat(t.data.data), 
                a.setData({
                    recGoodsList: a.data.recGoodsList
                }, function() {
                    a.data.rec_page++;
                }));
            },
            complete: function() {
                a.data.rec_loading = !1;
            }
        }));
    },
    getSimGoods: function() {
        var a = this;
        a.data.rec_loading || (a.data.rec_loading = !0, app.util.request({
            url: "entry/wxapp/getRcommendGoods",
            showLoading: !1,
            data: {
                page: a.data.rec_page,
                channel_type: 3,
                goods_id: a.data.goods_id,
                goods_sign: a.data.goods.goods_sign
            },
            success: function(t) {
                console.log("1"), console.log(t), t.data.data.length < 1 || (a.data.recGoodsList = 1 == a.data.rec_page ? t.data.data : a.data.recGoodsList.concat(t.data.data), 
                a.setData({
                    recGoodsList: a.data.recGoodsList
                }, function() {
                    a.data.rec_page++;
                }));
            },
            complete: function() {
                a.data.rec_loading = !1;
            }
        }));
    },
    toggleCollect: function() {
        var e = this;
        app.globalData.userInfo ? app.util.request({
            url: "entry/wxapp/toggleGoodsCollect",
            data: {
                goods_id: e.data.goods_id,
                source: e.data.source
            },
            success: function(t) {
                var a = e.data.goods.isCollect, o = a ? "已取消收藏" : "收藏成功";
                e.setData({
                    "goods.isCollect": !a
                }), wx.showToast({
                    title: o,
                    icon: "success"
                });
            }
        }) : app.checkLogin();
    },
    toVip: function() {
        wx.navigateTo({
            url: "../guest/guest"
        });
    },
    calPageHeight: function() {
        var a = this, t = wx.createSelectorQuery();
        t.select("#cont").boundingClientRect(), t.exec(function(t) {
            a.data.listHeight = t[0].height;
        });
    },
    goRedeem: function() {
        wx.navigateTo({
            url: "../redeem/redeem"
        });
    },
    onReachBottom: function() {
        var a;
        1 != this.data.goods.task.status || this.data.isStartRewards || this.data.goods.isRewards || (this.data.isStartRewards = !0, 
        this.setData({
            per: 100
        }), a = this, app.util.request({
            url: "entry/wxapp/rewardsViewGoods",
            data: {
                goods_id: a.data.goods_id,
                source: a.data.source
            },
            showLoading: !1,
            success: function(t) {
                "ok" == t.data.message ? (wx.showToast({
                    title: "+" + (a.data.goods.task.type ? a.data.goods.task.coin + "金币" : a.data.goods.task.money + "元"),
                    icon: "success"
                }), a.setData({
                    "goods.isRewards": !0
                }), app.innerAudioContext.play()) : wx.showToast({
                    title: t.data.message,
                    icon: "none"
                });
            }
        }));
    },
    showGoodsPic: function(t) {
        console.log(t);
        var t = t.target.dataset.index, a = this.data.goods;
        if (6 != this.data.source && 7 != this.data.source || !a.goods_detail_pics) wx.previewImage({
            current: a.goods_gallery_urls[t],
            urls: a.goods_gallery_urls
        }); else {
            var o = [];
            if (7 == this.data.source) for (var e in a.goods_detail_pics) /https/.test(a.goods_detail_pics[e]) ? o.push(a.goods_detail_pics[e]) : o.push("https:" + a.goods_detail_pics[e]); else for (var e in a.goods_detail_pics) /https/.test(a.goods_detail_pics[e].img) ? o.push(a.goods_detail_pics[e].img) : o.push("https:" + a.goods_detail_pics[e].img);
            console.log(o), wx.previewImage({
                current: o[t],
                urls: o,
                fail: function(t) {
                    console(t);
                }
            });
        }
    },
    getSharePic: function() {
        var a = this;
        app.util.request({
            url: "entry/wxapp/goodsSharePic",
            data: {
                goods_id: a.data.goods_id,
                source: a.data.source
            },
            showLoading: !1,
            success: function(t) {
                t = t.data.data, a.setData({
                    share_pic: t
                });
            }
        });
    },
    confirmSavePoster: function() {
        this.setData({
            showShareImg: !1
        }), this.hideShare();
    },
    delPoster: function() {
        app.util.request({
            url: "entry/wxapp/delTempPoster",
            showLoading: !1,
            success: function(t) {
                console.log(t);
            }
        });
    },
    saveGoodsPoster: function() {
        var a = this;
        app.util.request({
            url: "entry/wxapp/getGoodsPoster",
            data: {
                goods_id: a.data.goods_id,
                source: a.data.source
            },
            success: function(t) {
                a.setData({
                    showShareStatus: !1
                }), t = t.data.data, a.setData({
                    poster: t,
                    showShareImg: !0
                }), wx.getImageInfo({
                    src: t,
                    success: function(t) {
                        wx.saveImageToPhotosAlbum({
                            filePath: t.path,
                            success: function(t) {
                                wx.showToast({
                                    title: "保存至相册成功",
                                    icon: "success"
                                });
                            },
                            fail: function(t) {
                                console.log(t), wx.showModal({
                                    title: "系统提示",
                                    content: "请转至“授权设置”页面打开“保存到相册”开关",
                                    confirmColor: "#f43f6c",
                                    confirmText: "去打开",
                                    showCancel: !1,
                                    success: function(t) {
                                        wx.openSetting({
                                            withSubscriptions: !0,
                                            success: function() {}
                                        });
                                    }
                                });
                            }
                        });
                    },
                    complete: function() {
                        a.delPoster();
                    }
                });
            }
        });
    },
    goIndex: function() {
        this.rmFromUid(), wx.switchTab({
            url: "../index/index"
        });
    },
    showShare: function() {
        var t;
        app.globalData.userInfo ? (t = wx.createAnimation({
            duration: 500,
            timingFunction: "ease",
            delay: 0
        }), (this.animation = t).translateY(animationShowHeight).step(), this.setData({
            animationData: t.export(),
            showShareStatus: !0,
            showShareBg: !0
        }), setTimeout(function() {
            t.translateY(0).step(), this.setData({
                animationData: t.export()
            });
        }.bind(this), 1)) : app.checkLogin();
    },
    hideShare: function() {
        var t = wx.createAnimation({
            duration: 500,
            timingFunction: "ease",
            delay: 0
        });
        (this.animation = t).translateY(animationShowHeight).step(), this.setData({
            animationData: t.export()
        }), setTimeout(function() {
            t.translateY(0).step(), this.setData({
                animationData: t.export(),
                showShareStatus: !1,
                showShareBg: !1,
                showShareImg: !1
            });
        }.bind(this), 200);
    },
    navBack: function() {
        !app.globalData.from_uid || this.data.find ? wx.navigateBack() : this.goIndex(), 
        this.rmFromUid();
    },
    rmFromUid: function() {
        app.globalData.from_uid && (app.globalData.from_uid = !1, app.globalData.from_act = !1);
    },
    onLoad: function(t) {
        var a;
        console.log("options", t), this.setData({
            navH: app.globalData.navHeight,
            from_uid: app.globalData.from_uid,
            find: t.find,
            freered_id: t.freered_id || 0
        }), console.log("lololo", this.data.appletKeyword), void 0 !== t.goods_id && 0 != t.goods_id ? (void 0 !== t.source && (this.setData({
            source: t.source
        }), 3 != this.data.source && 5 != this.data.source || (this.data.goods_url = void 0 !== t.goods_url ? t.goods_url : "")), 
        1 == this.data.source && void 0 !== t.goods_sign && (this.data.goods_sign = t.goods_sign), 
        this.data.goods_id = t.goods_id, this.getGoodsDetail(), this.getHotGoods(), 1 == this.data.source && 1 == this.data.shopred_switch && (this.getShopRedSum(), 
        this.startSetInter()), app.globalData.setting ? this.setData({
            appletKeyword: app.globalData.setting.appletKeyword,
            shopred_switch: app.globalData.setting.shopred_switch,
            ddk_rule_url: app.globalData.setting.dd_rule_url
        }) : (a = this, app.config.init(function() {
            a.setData({
                appletKeyword: app.globalData.setting.appletKeyword,
                shopred_switch: app.globalData.setting.shopred_switch,
                ddk_rule_url: app.globalData.setting.dd_rule_url
            });
        }))) : wx.navigateBack();
    },
    toTaskPage: function() {
        wx.switchTab({
            url: "/first_duoduoke/pages/task/task"
        });
    },
    getShopRedSum: function() {
        var a = this;
        app.util.request({
            url: "entry/wxapp/getShopRedSum",
            showLoading: !1,
            success: function(t) {
                a.setData({
                    shop_red_sum: t.data.data
                });
            }
        });
    },
    showACommPics: function(t) {
        var a, t = t.target.dataset.caidx, o = this.data.goods.comments.comment.commentAppend.images;
        for (a in o) o[a] = "https:" + o[a];
        wx.previewImage({
            current: o[t],
            urls: o
        });
    },
    showCommPics: function(t) {
        if (6 == this.data.source) {
            var a = t.target.dataset.cidx;
            for (o in i = this.data.goods.comments.comment.images) i[o] = "https:" + i[o];
        }
        if (2 == this.data.source) {
            var o, e = t.target.dataset.cdx, a = t.target.dataset.cidx, s = this.data.goods.comments.list[e].imageList, i = [];
            for (o in s) i[o] = s[o].url;
        }
        wx.previewImage({
            current: i[a],
            urls: i
        });
    },
    wachVideo: function(t) {
        console.log(t), t = t.target.dataset.path, this.data.onVideo = !this.data.onVideo, 
        this.setData({
            onVideo: this.data.onVideo,
            videoPath: t
        });
    },
    getTbComments: function() {
        var a = this;
        app.util.request({
            url: "entry/wxapp/getTbComments",
            data: {
                goods_id: a.data.goods_id,
                show: 1
            },
            showLoading: !1,
            success: function(t) {
                a.setData({
                    "goods.comments": t.data.data
                });
            }
        });
    },
    getHistoryPrice: function() {
        var r = this;
        app.util.request({
            url: "entry/wxapp/getHistoryPrice",
            data: {
                goods_id: (4 == r.data.source ? r.data.goods.brandId + "-" : "") + r.data.goods_id,
                source: r.data.source,
                shop_type: r.data.goods.shop_type
            },
            showLoading: !1,
            success: function(t) {
                if ("[]" != t.data.data) {
                    var a, o = JSON.parse(t.data.data), e = new app.util.date(), s = {
                        x: [],
                        y: [],
                        z: [],
                        h: []
                    }, i = 0;
                    for (a in o) for (var d in o[a]) 0 == d && (s.x.push(e.dateToStr("MM-dd", new Date(o[a][d]))), 
                    s.h.push(e.dateToStr("yyyy年MM月dd日", new Date(o[a][d])))), 1 == d && ((0 == a || o[a][d] < i) && (i = o[a][d]), 
                    s.y.push(o[a][d])), 2 == d && s.z.push(o[a][d]);
                    r.setData({
                        showHisP: !0,
                        hisp_lowest: i
                    });
                    var t = r.selectComponent("#mychart-dom-line"), n = {
                        color: [ "#FF6729" ],
                        grid: {
                            containLabel: !0
                        },
                        tooltip: {
                            show: !0,
                            trigger: "axis",
                            position: [ 10, 5 ],
                            backgroundColor: "rgba(236,108,56, 1)",
                            formatter: function(t) {
                                return t = t[0].dataIndex, s.h[t] + " ￥" + s.y[t] + (s.z[t] ? "\n" + s.z[t] : "");
                            }
                        },
                        xAxis: {
                            type: "category",
                            boundaryGap: !1,
                            data: s.x,
                            splitLine: {
                                lineStyle: {
                                    type: "dashed"
                                }
                            }
                        },
                        yAxis: {
                            x: "center",
                            type: "value",
                            splitLine: {
                                lineStyle: {
                                    type: "dashed"
                                }
                            }
                        },
                        series: [ {
                            name: "历史价格",
                            type: "line",
                            data: s.y
                        } ]
                    };
                    t.init(function(t, a, o) {
                        return o = echarts.init(t, null, {
                            width: a,
                            height: o
                        }), t.setChart(o), o.setOption(n), o;
                    });
                }
            }
        });
    },
    getGoodsDetail: function(a) {
        var o = this;
        switch (parseInt(o.data.source)) {
          case 1:
            var t = "entry/wxapp/getGoodsDetail", e = {
                goods_id: o.data.goods_id,
                freered_id: o.data.freered_id,
                goods_sign: o.data.goods_sign
            };
            break;

          case 2:
            t = "entry/wxapp/getJdDetail", e = {
                goods_id: o.data.goods_id
            };
            break;

          case 3:
            t = "entry/wxapp/getMgDetail", e = {
                goods_url: encodeURIComponent(o.data.goods_url),
                goods_id: o.data.goods_id
            };
            break;

          case 4:
            t = "entry/wxapp/getVipDetail", e = {
                goods_id: o.data.goods_id
            };
            break;

          case 5:
            t = "entry/wxapp/getSnDetail", e = {
                goods_url: o.data.goods_url,
                goods_id: o.data.goods_id
            };
            break;

          case 6:
            t = "entry/wxapp/getTbDetail", e = {
                goods_id: o.data.goods_id
            };
            break;

          case 7:
            t = "entry/wxapp/getKlDetail", e = {
                goods_id: o.data.goods_id
            };
        }
        app.util.request({
            url: t,
            data: e,
            success: function(t) {
                console.log(t), "function" == typeof a && a(), (t = t.data.data).mobile_short_url = t.mobile_short_url || "", 
                o.setData({
                    mobile_short_url: t.mobile_short_url,
                    goods: t,
                    opt_id: t.opt_id,
                    goods_redpack: ((t.min_group_price - t.coupon_discount) / 200).toFixed(2)
                }, function() {
                    o.getSharePic(), 1 == o.data.source ? o.getSimGoods() : o.getRecGoods(), 3 != o.data.source && o.getHistoryPrice(), 
                    6 == o.data.source && (o.getTbComments(), 1 == app.globalData.setting.tb_closure_switch && wx.setClipboardData && wx.setClipboardData({
                        data: o.data.goods.mobile_short_url,
                        success: function() {
                            app.globalData.showSmart = !1, wx.hideToast();
                        }
                    }));
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {
        1 == this.data.source && !1 !== this.data.goods && "" == this.data.goods.mobile_short_url && this.getGoodsDetail(), 
        app.reUserInfo();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {
        this.getGoodsDetail(function() {
            wx.stopPullDownRefresh();
        });
    },
    loginAfter: function(t) {
        app.loginAfter(t);
    },
    loginCancel: function() {
        app.loginCancel();
    },
    fromToDuoDuo: function() {
        var t, o = this;
        1 == o.data.source && "" == o.data.goods.mobile_short_url ? app.globalData.userInfo ? app.util.request({
            url: "entry/wxapp/checkUserAuth",
            success: function(t) {
                console.log(t);
                var a = t.data;
                "need" == a.message ? wx.showModal({
                    title: "系统信息",
                    content: "需要先去拼多多授权才能购买:)",
                    showCancel: !1,
                    confirmColor: "#f43f6c",
                    confirmText: "去授权",
                    complete: function() {
                        wx.navigateToMiniProgram({
                            appId: a.data.app_id,
                            path: a.data.page_path,
                            success: function(t) {
                                console.log("ok"), wx.navigateBack();
                            }
                        });
                    }
                }) : o.data.goods.predict_promotion_rate ? wx.navigateToMiniProgram({
                    appId: o.data.goods.appid,
                    path: o.data.goods.page_path,
                    success: function(t) {
                        console.log("ok");
                    }
                }) : wx.showModal({
                    title: "系统信息",
                    content: "亲~，该商品被系统判定为比价商品，购买后无法获得佣金哦",
                    showCancel: !0,
                    confirmColor: "#f43f6c",
                    cancelColor: "#f43f6c",
                    confirmText: "直接购买",
                    cancelText: o.data.ddk_rule_url ? "查看新规" : "考虑看看",
                    success: function(t) {
                        t.confirm && wx.navigateToMiniProgram({
                            appId: o.data.goods.appid,
                            path: o.data.goods.page_path,
                            success: function(t) {
                                console.log("ok");
                            }
                        }), t.cancel && o.data.ddk_rule_url && wx.navigateTo({
                            url: "../index/web-view?url=" + encodeURIComponent(o.data.ddk_rule_url)
                        });
                    }
                });
            }
        }) : app.checkLogin() : (t = "", 7 == o.data.source && (t = {
            unionId: o.data.goods.kl_unionId,
            tc1: o.data.goods.tc1,
            tc2: o.data.goods.tc2
        }), wx.navigateToMiniProgram({
            appId: o.data.goods.appid,
            path: o.data.goods.page_path,
            extraData: t,
            success: function(t) {
                console.log("ok");
            },
            fail: function(t) {
                console.log(t);
            }
        }));
    },
    toDuoDuo: function() {
        var t, o = this;
        app.globalData.userInfo ? 1 == o.data.source ? app.util.request({
            url: "entry/wxapp/checkUserAuth",
            success: function(t) {
                console.log(t);
                var a = t.data;
                "need" == a.message ? wx.showModal({
                    title: "系统信息",
                    content: "需要先去拼多多授权才能购买:)",
                    showCancel: !1,
                    confirmColor: "#f43f6c",
                    confirmText: "去授权",
                    complete: function() {
                        wx.navigateToMiniProgram({
                            appId: a.data.app_id,
                            path: a.data.page_path,
                            success: function(t) {
                                console.log("ok"), wx.navigateBack();
                            }
                        });
                    }
                }) : o.data.goods.predict_promotion_rate ? wx.navigateToMiniProgram({
                    appId: o.data.goods.appid,
                    path: o.data.goods.page_path,
                    success: function(t) {
                        console.log("ok");
                    }
                }) : wx.showModal({
                    title: "系统信息",
                    content: "亲~，该商品被系统判定为比价商品，购买后无法获得佣金哦",
                    showCancel: !0,
                    confirmColor: "#f43f6c",
                    cancelColor: "#f43f6c",
                    confirmText: "直接购买",
                    cancelText: o.data.ddk_rule_url ? "查看新规" : "考虑看看",
                    success: function(t) {
                        t.confirm && wx.navigateToMiniProgram({
                            appId: o.data.goods.appid,
                            path: o.data.goods.page_path,
                            success: function(t) {
                                console.log("ok");
                            }
                        }), t.cancel && o.data.ddk_rule_url && wx.navigateTo({
                            url: "../index/web-view?url=" + encodeURIComponent(o.data.ddk_rule_url)
                        });
                    }
                });
            }
        }) : 6 == o.data.source ? o.setData({
            tbCopy: !0
        }) : (t = "", 7 == o.data.source && (t = {
            unionId: o.data.goods.kl_unionId,
            tc1: o.data.goods.tc1,
            tc2: o.data.goods.tc2
        }), wx.navigateToMiniProgram({
            appId: o.data.goods.appid,
            path: o.data.goods.page_path,
            extraData: t,
            success: function(t) {
                console.log("ok");
            }
        })) : app.checkLogin();
    },
    copyTpwd: function() {
        var a = this;
        wx.setClipboardData ? wx.setClipboardData({
            data: a.data.goods.mobile_short_url,
            success: function(t) {
                app.globalData.showSmart = !1, a.setData({
                    copyTbBtnText: "复制成功"
                }), app.globalData.userInfo.tao_ord || a.data.goods.tao_bind || (wx.showModal({
                    title: "系统信息",
                    content: "“首次”复制口令购买后您须手动复制淘宝订单号，添加至小程序订单页面实现返佣，后续即可自动返佣：）",
                    showCancel: !1,
                    confirmColor: "#f43f6c",
                    confirmText: "朕知道了",
                    complete: function() {}
                }), wx.hideToast());
            }
        }) : console.log("当前微信版本不支持setClipboardData");
    },
    hidetbCopy: function() {
        this.setData({
            tbCopy: !1
        });
    },
    onShareTimeline: function() {
        var t = this, a = void 0 !== app.globalData.userInfo.uid ? "from_uid=" + app.globalData.userInfo.uid + "&goods_id=" + t.data.goods_id + "&from_act=share&source=" + t.data.source : "goods_id=" + t.data.goods_id + "&source=" + t.data.source;
        return {
            title: t.data.goods.goods_name,
            imageUrl: t.data.goods.goods_gallery_urls[0],
            query: a
        };
    },
    onShareAppMessage: function() {
        var t = this, a = t.data.goods.share_title || "购物省钱，分享赚钱", o = t.data.share_pic || app.globalData.setting.share_pic;
        return {
            title: a,
            path: "/first_duoduoke/pages/goods/goods" + (void 0 !== app.globalData.userInfo.uid ? "?from_uid=" + app.globalData.userInfo.uid + "&goods_id=" + t.data.goods_id + "&from_act=share&source=" + t.data.source : "?goods_id=" + t.data.goods_id + "&source=" + t.data.source),
            imageUrl: o,
            success: function(t) {
                "shareAppMessage:ok" == t.errMsg ? wx.showToast({
                    title: "分享成功",
                    icon: "success"
                }) : wx.showToast({
                    title: "分享失败",
                    icon: "none"
                });
            },
            fail: function(t) {
                "shareAppMessage:fail cancel" == t.errMsg || t.errMsg, wx.showToast({
                    title: "分享失败",
                    icon: "none"
                });
            }
        };
    },
    startSetInter: function() {
        var t = this;
        t.setData({
            beginAnimation: !0
        }), setTimeout(function() {
            t.endSetInter();
        }, 3e3);
    },
    endSetInter: function() {
        this.setData({
            beginAnimation: !1
        }), this.startSetInter();
    },
    onPageScroll: function(t) {
        app.globalData.userInfo.uid && "devtools" != app.platform && (1 != this.data.goods.task.status || this.data.isStartRewards || (t = Math.round(t.scrollTop / this.data.listHeight * 1e4) / 100, 
        this.setData({
            per: t
        }), 0 == this.data.per ? this.setData({
            left_deg: 45,
            right_deg: 45
        }) : this.data.per <= 5 ? this.setData({
            left_deg: 45,
            right_deg: 63
        }) : this.data.per <= 10 ? this.setData({
            left_deg: 45,
            right_deg: 81
        }) : this.data.per <= 15 ? this.setData({
            left_deg: 45,
            right_deg: 99
        }) : this.data.per <= 20 ? this.setData({
            left_deg: 45,
            right_deg: 117
        }) : this.data.per <= 25 ? this.setData({
            left_deg: 45,
            right_deg: 135
        }) : this.data.per <= 30 ? this.setData({
            left_deg: 45,
            right_deg: 153
        }) : this.data.per <= 35 ? this.setData({
            left_deg: 45,
            right_deg: 171
        }) : this.data.per <= 40 ? this.setData({
            left_deg: 45,
            right_deg: 189
        }) : this.data.per <= 45 ? this.setData({
            left_deg: 45,
            right_deg: 207
        }) : this.data.per <= 50 ? this.setData({
            left_deg: 45,
            right_deg: 225
        }) : this.data.per <= 55 ? this.setData({
            left_deg: 63,
            right_deg: 225
        }) : this.data.per <= 60 ? this.setData({
            left_deg: 81,
            right_deg: 225
        }) : this.data.per <= 65 ? this.setData({
            left_deg: 99,
            right_deg: 225
        }) : this.data.per <= 70 ? this.setData({
            left_deg: 117,
            right_deg: 225
        }) : this.data.per <= 75 ? this.setData({
            left_deg: 135,
            right_deg: 225
        }) : this.data.per <= 80 ? this.setData({
            left_deg: 153,
            right_deg: 225
        }) : this.data.per <= 85 ? this.setData({
            left_deg: 171,
            right_deg: 225
        }) : this.data.per <= 90 ? this.setData({
            left_deg: 189,
            right_deg: 225
        }) : this.data.per <= 95 ? this.setData({
            left_deg: 207,
            right_deg: 225
        }) : 100 <= this.data.per && this.setData({
            left_deg: 225,
            right_deg: 225
        })));
    }
});